package com.mofang.activity.user;

import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import com.mofang.R;
import com.mofang.activity.BaseTitleViewActiviey;
import com.mofang.adapters.BankNameAdapter;
import com.pactera.framework.util.ToastHelper;

public class BankNameSelectActivity extends BaseTitleViewActiviey {

	private ListView bank_name_list;
	private BankNameAdapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.activity_bank_name_select);
		super.onCreate(savedInstanceState);
		setNavigationTitle("选择银行");
		setNavigationLeftBtnImage(R.drawable.return_arrow);
		adapter = new BankNameAdapter(getApplicationContext());
		bank_name_list.setAdapter(adapter);
	}

	@Override
	protected void initView() {
		super.initView();
		bank_name_list = (ListView) findViewById(R.id.common_id_lv);
	}

	@Override
	protected void setListener() {
		super.setListener();
		bank_name_list.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				//ToastHelper.getInstance().showShortMsg("" + position);
				// 判断空，我就不判断了。。。。
				Intent data = new Intent();
				data.putExtra("id", position);
				// 请求代码可以自己设置，这里设置成20
				setResult(RESULT_OK, data);
				// 关闭掉这个Activity
				finish();
				// BankNameSelectActivity.this.finish();
			}

		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.bank_name_select, menu);
		return true;
	}

}
